package edu.xkd.slice;

import edu.xkd.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.Component;

public class MainAbilitySlice extends AbilitySlice {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);


        //获取按钮对象
        Button button_01 = (Button) this.findComponentById(ResourceTable.Id_button_01);
        button_01.setClickedListener(this::clickedListenerButton01);
    }

    private void clickedListenerButton01(Component component) {
        Intent intent = new Intent();
        this.present(new MainAbilitySlice02(), intent);
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
